﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ViewPurchaseOrder.aspx.cs"
    Inherits="Main_Inventory_ViewPurchaseOrder" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Purchase Order View</title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/HorizontalTab.css" rel="stylesheet" type="text/css" />
    <script src="../../JavaScript/HorizontalTab.js" type="text/javascript"></script>
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    <script src="../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function divExpandCollapse(divname) {
            var div = document.getElementById(divname);
            var img = document.getElementById('img' + divname);
            if (div.style.display == "none") {
                div.style.display = "inline";
                img.src = "../../Menu/images/minus.gif";
            }
            else {
                div.style.display = "none";
                img.src = "../../Menu/images/plus.gif";
            }
        }

        $(document).ready(function () {
            $('.tabs a').click(function () {
                switch_tabs($(this));
            });
            switch_tabs($('.defaulttab'));
        });
        function switch_tabs(obj) {
            $('.tab-content').hide();
            $('.tabs a').removeClass("selected");
            var id = obj.attr("rel");
            $('#' + id).show();
            obj.addClass("selected");
        }    
    </script>
    <style type="text/css">
        #Viewwrapper
        {
            width: 100%;
            margin-left: 1%;
            margin-top: 15px;
        }
        .tab
        {
            border: 1px solid #DDD;
        }
        .tab .ajax__tab_body
        {
            padding: 10px;
        }
        .tab .ajax__tab_header
        {
            font-size: 11px;
            font-weight: bold;
            background: #F5F5F5;
            border-bottom: 1px solid #bbb;
            border-top: 1px solid #BBB;
        }
        .tab .ajax__tab_header .ajax__tab_active .ajax__tab_outer
        {
            height: 20px;
            background: #88BD6E;
        }
        .tab .ajax__tab_header .ajax__tab_active .ajax__tab_tab
        {
            background: #88BD6E;
            height: 20px;
            padding: 5px 7px 5px 7px;
            margin: 0px;
            border: 0;
            color: #333;
        }
        .tab .ajax__tab_header .ajax__tab_active .ajax__tab_inner
        {
            padding-left: 0px;
            background: #fff;
            border-right: 1px solid #bbb;
            border-left: 1px solid #bbb;
            border-bottom: 0;
        }
        .tab .ajax__tab_tab
        {
            padding: 7px;
            color: #333;
            border-right: 1px solid #bbb;
            border-left: 1px solid #bbb;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divprint" runat="server" style="width: 99%;">
     <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true">
    </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="PurchaseOrder Manager Approval" />
        <div style="margin-left: 1%;">
            <table>
                <tr>
                    <td>
                    </td>
                    <td>
                        <%--<MyControls:CommonControls ID="CommonControls2" runat="server" GridviewControlId="grdDisplay" HideColumns="8,9" />--%>
                    </td>
                    <%--<td>Filter:
                            <asp:DropDownList ID="ddlSearch" runat="server" CssClass="input" AutoPostBack="true" 
                                onselectedindexchanged="ddlSearch_SelectedIndexChanged">
                                <asp:ListItem Text="Select PO" Value="0"></asp:ListItem>
                                <asp:ListItem Text="Pending PO" Value="1"></asp:ListItem>
                                <asp:ListItem Text="Completed PO" Value="2"></asp:ListItem>
                            </asp:DropDownList>                    
                        </td>--%>
                </tr>
                <tr>
                    <td colspan="3">
                    </td>
                </tr>
            </table>
        </div>
        <asp:Label ID="lblMsg" runat="server"></asp:Label>
        <asp:Panel ID="PanelDisplay" runat="server" Width="100%">
            <div id="div1" runat="server" style="margin-left: 10px;">
                <AjaxControl:TabContainer ID="MainTab" CssClass="tab" runat="server" ActiveTabIndex="0"
                    OnDemand="true" AutoPostBack="false" TabStripPlacement="Top" ScrollBars="None">
                    <AjaxControl:TabPanel ID="DomesticTab" HeaderText="Domestic" runat="server" Enabled="true"
                        ScrollBars="Auto" OnDemandMode="Once">
                        <ContentTemplate>
                            <asp:GridView ID="grdDisplay" Width="99%" runat="server" AutoGenerateColumns="false"
                                CssClass="gridview" AllowPaging="true" DataKeyNames="POID" AlternatingRowStyle-CssClass="gridview_alternate"
                                PagerStyle-CssClass="pgr" OnPageIndexChanging="grdDisplay_OnPageIndexChanging"
                                RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowCommand="grdDisplay_RowCommand"
                                OnRowDataBound="grdDisplay_RowDataBound" OnRowCreated="grdDisplay_RowCreated"
                                PageSize="20">
                                <Columns>
                                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex+1 %>
                                            <a href="Javascript:divExpandCollapse('div<%# Eval("POID") %>');">
                                                <img id="imgdiv<%#Eval("POID") %>" width="9px" border="0" src="../../Menu/images/plus.gif" />
                                            </a>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <%--<asp:BoundField HeaderText="P.O. No." DataField="PoVoucherNo" NullDisplayText="-" />--%>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblpono" runat="server" Text="P.O.No."></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="imgBtnSort" runat="server" CommandName="Sort" CommandArgument="POVOUCHERNO"
                                                            ImageUrl="~/Images/sort.png" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblpono" runat="server" Text='<%#Bind("PONo")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="P.O. Date" DataField="PoDate" DataFormatString="{0:dd-MMM-yyyy}" />
                                    <asp:BoundField HeaderText="Vendor Name" DataField="Lname" />
                                    <asp:BoundField HeaderText="Delivery Date" DataField="DeliveryDate" DataFormatString="{0:dd-MMM-yyyy}" />
                                    <asp:BoundField HeaderText="Priority" DataField="Priority" />
                                    <asp:BoundField HeaderText="Quantity" DataField="Quantity" DataFormatString="{0:0}"
                                        ItemStyle-HorizontalAlign="Right" />
                                    <asp:BoundField HeaderText="Total Amount" DataField="GrandTotal" ItemStyle-HorizontalAlign="Right" />
                                    <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="left">
                                        <ItemTemplate>
                                            <asp:Label ID="lblStatusOfPO" runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnview" runat="server"><a href="#" onclick="window.open('InventoryPrint/Default.aspx?Poid=<%#DataBinder.Eval(Container.DataItem,"POID")%>','','width=800,height=600,toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes')">View</a></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <%--<asp:CommandField HeaderText="Edit" ID="lnkEdit" runat="server"  SelectText="<img src='../../Menu/images/Edit_user.png' alt='Edit'>" ShowSelectButton="true" />                                     --%>
                                            <asp:LinkButton ID="lnkEdit" runat="server" CommandArgument='<%#Bind("POID")%>' CommandName="editpo"
                                                Font-Underline="false"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:LinkButton>
                                            <asp:Image ID="imgLock" runat="server" ImageUrl="../../Images/lock.png" Height="16px"
                                                Width="16px" AlternateText="Approved" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <tr>
                                                <td colspan="100%">
                                                    <div id="div<%# Eval("POID") %>" style="display: none; position: relative; left: 15px;
                                                        overflow: auto">
                                                        <asp:GridView ID="gvPORemarksChild" runat="server" CssClass="gridview" AutoGenerateColumns="false"
                                                            Width="96%">
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="S.No">
                                                                    <ItemTemplate>
                                                                        <%# Container.DataItemIndex+1 %>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="POSTAGE" HeaderText="By Whom" />
                                                                <asp:BoundField DataField="REMARKS" HeaderText="Remarks" NullDisplayText="--" />
                                                                <asp:BoundField DataField="REVISIONORDER" HeaderText="Revision Order" NullDisplayText="--" />
                                                                <asp:BoundField DataField="CDATE" HeaderText="Date" ItemStyle-HorizontalAlign="Right" />
                                                                <asp:BoundField DataField="CTIME" HeaderText="Time" ItemStyle-HorizontalAlign="Right" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </div>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </AjaxControl:TabPanel>
                    <AjaxControl:TabPanel ID="InternationalTab" HeaderText="International" runat="server" Enabled="true"
                        ScrollBars="Auto" OnDemandMode="Once">
                        <ContentTemplate>
                            <asp:GridView ID="grdInternational" runat="server" Width="99%" AutoGenerateColumns="false"
                                CssClass="gridview" AllowPaging="true" DataKeyNames="POID" AlternatingRowStyle-CssClass="gridview_alternate"
                                PagerStyle-CssClass="pgr" OnPageIndexChanging="grdInternational_OnPageIndexChanging"
                                RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowCommand="grdInternational_RowCommand"
                                OnRowDataBound="grdInternational_RowDataBound" OnRowCreated="grdInternational_RowCreated"
                                PageSize="20">
                                <Columns>
                                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex+1 %>
                                            <a href="Javascript:divExpandCollapse('div<%# Eval("POID") %>');">
                                                <img id="imgdiv<%#Eval("POID") %>" width="9px" border="0" src="../../Menu/images/plus.gif" />
                                            </a>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <%--<asp:BoundField HeaderText="P.O. No." DataField="PoVoucherNo" NullDisplayText="-" />--%>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="lblpono" runat="server" Text="P.O.No."></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:ImageButton ID="imgBtnSort" runat="server" CommandName="Sort" CommandArgument="POVOUCHERNO"
                                                            ImageUrl="~/Images/sort.png" />
                                                    </td>
                                                </tr>
                                            </table>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="lblpono" runat="server" Text='<%#Bind("PONo")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField HeaderText="P.O. Date" DataField="PoDate" DataFormatString="{0:dd-MMM-yyyy}" />
                                    <asp:BoundField HeaderText="Vendor Name" DataField="Lname" />
                                    <asp:BoundField HeaderText="Delivery Date" DataField="DeliveryDate" DataFormatString="{0:dd-MMM-yyyy}" />
                                    <asp:BoundField HeaderText="Priority" DataField="Priority" />
                                    <asp:BoundField HeaderText="Quantity" DataField="Quantity" DataFormatString="{0:0}"
                                        ItemStyle-HorizontalAlign="Right" />
                                    <asp:BoundField HeaderText="Total Amount" DataField="GrandTotal" ItemStyle-HorizontalAlign="Right" />
                                    <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="left">
                                        <ItemTemplate>
                                            <asp:Label ID="lblStatusOfPO" runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="lbtnview" runat="server"><a href="#" onclick="window.open('InventoryPrint/Default.aspx?Poid=<%#DataBinder.Eval(Container.DataItem,"POID")%>','','width=800,height=600,toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes')">View</a></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                                        <ItemTemplate>
                                            <%--<asp:CommandField HeaderText="Edit" ID="lnkEdit" runat="server"  SelectText="<img src='../../Menu/images/Edit_user.png' alt='Edit'>" ShowSelectButton="true" />                                     --%>
                                            <asp:LinkButton ID="lnkEdit" runat="server" CommandArgument='<%#Bind("POID")%>' CommandName="editpo"
                                                Font-Underline="false"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:LinkButton>
                                            <asp:Image ID="imgLock" runat="server" ImageUrl="../../Images/lock.png" Height="16px"
                                                Width="16px" AlternateText="Approved" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <tr>
                                                <td colspan="100%">
                                                    <div id="div<%# Eval("POID") %>" style="display: none; position: relative; left: 15px;
                                                        overflow: auto">
                                                        <asp:GridView ID="gvPORemarksChild" runat="server" CssClass="gridview" AutoGenerateColumns="false"
                                                            Width="96%">
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="S.No">
                                                                    <ItemTemplate>
                                                                        <%# Container.DataItemIndex+1 %>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="POSTAGE" HeaderText="By Whom" />
                                                                <asp:BoundField DataField="REMARKS" HeaderText="Remarks" NullDisplayText="--" />
                                                                <asp:BoundField DataField="REVISIONORDER" HeaderText="Revision Order" NullDisplayText="--" />
                                                                <asp:BoundField DataField="CDATE" HeaderText="Date" ItemStyle-HorizontalAlign="Right" />
                                                                <asp:BoundField DataField="CTIME" HeaderText="Time" ItemStyle-HorizontalAlign="Right" />
                                                            </Columns>
                                                        </asp:GridView>
                                                    </div>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </AjaxControl:TabPanel>
                </AjaxControl:TabContainer>
            </div>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
